package com.agassi.edu.jee.bazar.logic;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;

import com.agassi.edu.jee.bazar.persistence.Order;

/**
 * Message-Driven Bean implementation class for: OrderBillingMDB
 *
 */
@MessageDriven(
		activationConfig = { 
				@ActivationConfigProperty(
						propertyName = "destinationType",
						propertyValue = "javax.jms.Queue"
				),
				@ActivationConfigProperty (
						propertyName="destinationName",
						propertyValue="jms/OrderBillingQueue")
					}
		)
	
public class OrderBillingMDB implements MessageListener {

    /**
     * Default constructor. 
     */
    public OrderBillingMDB() {
        // TODO Auto-generated constructor stub
    }
	
	/**
     * @see MessageListener#onMessage(Message)
     */
    public void onMessage(Message message) {        
        	ObjectMessage objectMessage =(ObjectMessage)message;
        	try {
				Order order = (Order)objectMessage.getObject();
				//TODO bill order
				//TODO update order
			} catch (JMSException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        
        
    }

}
